<html>

<SCRIPT language="javascript">
 $(document).ready(function(){
	$('#event_description').redactor();
 <%if $errors == true %>
  $('#myModal').modal("show");

  <%  end%>
});
</SCRIPT>
<div class="row">
			<div class="span8">
				<div style="padding-left:20px">
					<div align="center" style="margin-top:10px;width:200px;display:inline-block">
						<%= image_tag(@event_show.photo.url, :size => "300x200") %>
						<% if admin_authenticated? %>
						</br>
						<div align="center">
						</br>
						<%= button_to("Delete", @event_show, :confirm => "Are you sure you want to delete this event?", :method => "delete", :class => "btn btn-danger", :style => 'horizontal-align:left;width:150px;') %>
						</div>
						<% end %>
					</div>
					<div class="event-content">
						<h3><%=@event_show.title%></h3>
						<% if admin_authenticated? %>
						<%= link_to("[Edit]", { :controller => "events", :action => "edit", :id => @event_show.id }) %>
						<% end %>
						<p style="color:grey;font-size:14px;float:right;"><%=@event_show.start_date%> to <%=@event_show.end_date%></p>
						</br>
						</br>
						<p><%=@event_show.description.html_safe%></p>
					</div>
				</div>
			</div>
			<div class="span4">
				<div style="height:400px;border-left:1px solid #a0a0a0;padding-left:20px;width:330px;overflow:auto;">
					<% if admin_authenticated? %>
					<a href="#myModal" role="button" class="event-box" data-toggle="modal" style="height:65px;color:black;background-color:#5bb75b;border:1px solid #277439">
					<div class="event-image" style="padding-left:50px"> <font size=7><b>+</b></font> </div>
					<div class="event-image"> <font size=5> Add Event </font> </div>
					</a>
					<% end %>
					<% @events.each do |e| %>
					<a href="/events/<%=e.id%>" style="color:black"><div class="event-box">
						<div class="event-image"> <%= image_tag(e.photo.url, :size => "50x64") %> </div>
						<div class="event-title"><b><%= e.title %></b></div>
						<div class="event-date">
							<%= e.start_date.strftime("%A") %></br>
							<%= e.start_date.strftime("%d") %></br>
							<%= e.start_date.strftime("%B") %>
						</div>
					</div></a>
					<% end %>
				</div>
			</div>
		</div>
	</div>
<% if admin_authenticated? %>
	<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Create a new Event</h3>
</div>
<div class="modal-body">
<div>
				<% @event= Event.new if @event.nil? %>
				<%= form_for @event, :html => {:multipart => true} do |f| %>
						<%= render 'shared/error_messages' %>
						<p><%=f.text_field(:title, :placeholder => "Enter the event's Title", :style=>'width: 320px;')%></p>
						<p>Dates:  &nbsp; <%=f.text_field(:start_date, :placeholder => "DD/MM/YYYY", :style=>'width: 90px;')%> to <%=f.text_field(:end_date, :placeholder => "DD/MM/YYYY", :style=>'width: 90px;')%></p>
						<p>Description:<br/><%=f.text_area(:description, :style=>'width: 320px;height:200px',:placeholder => "Enter the event's description")%></p>
						<p>Image: <%= f.file_field(:photo) %> </p>

</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<%= f.submit("Create event", :class => "btn btn-success")%>
<% end %>
<% end %>
</div>
</div>
</html>
</html>
